hidpi: Rescan monitors when screen scale factor changes
authorAlexander Larsson <alexl@redhat.com>
Mon, 10 Feb 2020 14:19:32 +0000 (15:19 +0100)
committerAlexander Larsson <alexl@redhat.com>
Mon, 10 Feb 2020 14:34:32 +0000 (15:34 +0100)
All the code in e.g. init_randr15() divides the physical resolutions with
the screen scale, however if we get the screen scale from xsettings
rather than e.g. GDK_SCALE the initial setup is using the wrong value.

So, whenever the screen scale size is changed we need to trigger
a re-read of the randr data

gdk/x11/gdkscreen-x11.c

index 838a6d1cf10a9c847dcd5b8831b82f0570f54bd1..b99972a02929fb8505e38dc3e47469e53f928160 100644 (file)
@@ -49,6 +49,7 @@
 static void gdk_x11_screen_dispose  (GObject      *object);
 static void gdk_x11_screen_finalize (GObject      *object);
 static void init_randr_support     (GdkX11Screen *screen);
+static void process_monitors_change (GdkX11Screen *screen);
 
 enum
 {
@@ -963,6 +964,9 @@ _gdk_x11_screen_set_surface_scale (GdkX11Screen *x11_screen,
 
       gdk_monitor_set_scale_factor (monitor, scale);
     }
+
+  /* We re-read the monitor sizes so we can apply the new scale */
+  process_monitors_change (x11_screen);
 }
 
 static void